package stz.flash.option.flashlight;

import stz.flash.main.flashlight.model.Flashlight;
import stz.flash.option.PersistentData;
import util.DjObservable;


/**
 * 옵저버로 등록되어있는 클래스
 *  @param Flashlight
 */

public class FlashlightOption extends DjObservable{
	
	private static FlashlightOption instance = new FlashlightOption();
	
	private static boolean currentFlashState;
	private PersistentData data = PersistentData.getPersistentDatabase();

	public FlashlightOption() {
		addObserver(Flashlight.getIns());
	}

	public static FlashlightOption getIns() {
		return instance;
	}
	

	public void setStartupAndCurrentFlashState(boolean flashState) {
		data.setStartupFlashState(flashState);
		setCurrentFlashState(flashState);
	}
	public boolean isStartupFlashState() {
		return data.isStartupFlashState();
	}
	
	
	public static void setCurrentFlashState(boolean flashState) {
		currentFlashState = flashState;
	}
	public static boolean isCurrentFlashState() {
		return currentFlashState;
	}

	
	public void notifyFlashlight(){
		notifyObservers();
	}
	
	public void updateFlashStateWithStartupSet(){
		currentFlashState = isStartupFlashState();
	}
}
